function change(){
	//通过父元素li，找到兄弟元素ul
	var oSecondDiv = this.parentNode.getElementsByTagName("ul")[0];
	//CSS交替更换来实现显、隐
	if(oSecondDiv.className == "myHide"){
		oSecondDiv.className = "myShow";
		}
	else
		oSecondDiv.className = "myHide";
		
		


	if(this.className == "nonavhover"){
		this.className = "navhover";
		}
	else
		this.className = "nonavhover";

}
function change2(){
	//通过父元素li，找到兄弟元素ul
	var oSecondDiv = this.parentNode.getElementsByTagName("ul")[0];
	//CSS交替更换来实现显、隐
	if(oSecondDiv.className == "myHide"){
		oSecondDiv.className = "myShow";
		}
	else
		oSecondDiv.className = "myHide";
		
		


	if(this.className == "nonavhover"){
		this.className = "navhover";
		}
	else
		this.className = "nonavhover";

}


window.onload = function(){
	var oUl = document.getElementById("listUL");
	var oUl2 = document.getElementById("listUL2");
	var aLi = oUl.childNodes;	//子元素
	var aLi2 = oUl2.childNodes;	//子元素
	var oA;
	var oA2;

	for(var i=0;i<aLi.length;i++){
		//如果子元素为li，且这个li有子菜单ul
		
		if(aLi[i].tagName == "LI" && aLi[i].getElementsByTagName("ul").length){
			aLi[i].className="navhover";
			oA = aLi[i].firstChild;	//找到超链接
			oA.onclick = change;	//动态添加点击函数

		}
	}
	
	for(var i=0;i<aLi2.length;i++){
		//如果子元素为li，且这个li有子菜单ul
		
		if(aLi[i].tagName == "LI" && aLi2[i].getElementsByTagName("ul").length){
			aLi[i].className="navhover";
			oA2 = aLi2[i].firstChild;	//找到超链接
			oA2.onclick = change2;	//动态添加点击函数

		}
	}
}

